<?php
require_once('connection.php');
function getQuantity($oid){
	$sql_getFromContains = "SELECT contains.fname, contains.fsize
							FROM contains
							WHERE contains.oid = '$oid'";
	$resultIncontains = mysql_query($sql_getFromContains);
	if (!$resultIncontains){
		die('Error: ' . mysql_error());
		return false;
	}
	$f = mysql_fetch_array($resultIncontains);
	$fname = $f['fname'];
	$fsize = $f['fsize'];
    $sql_available = "SELECT f.quantity 
					  FROM flowers f
					  WHERE f.fname = '$fname' AND f.size = '$fsize'";
	$favaliableNumResult = mysql_query($sql_available);
	if (!$favaliableNumResult){
		die('Error: ' . mysql_error());
		return false;
	}
	$row_num = mysql_fetch_row($favaliableNumResult);
	$avaliable_num = $row_num[1];
	return $avaliable_num;
}
?>